package com.ruoyi.project.domain.entity;

import java.util.*;
public class ProjectDocumentRules {

    private static final Map<Integer, List<Material>> STAGE_MATERIALS = new HashMap<>();

    static {
        // 立项前期（阶段2）
        STAGE_MATERIALS.put(2, Arrays.asList(
                new Material(0, "预合同图纸"),
                new Material(1, "预合同清单"),
                new Material(2, "预算清单"),
                new Material(3, "预算图纸")
        ));

        // 项目实施（阶段3）
        STAGE_MATERIALS.put(3, Arrays.asList(
                new Material(5, "正式清单"),
                new Material(4, "正式合同"),
                new Material(12, "开工报告"),
                new Material(10, "劳务合同-昊诚"),
                new Material(11, "施工安全协议书-昊诚"),
                new Material(13, "设备签收单"),
                new Material(14, "联系单"),
                new Material(15, "进度节点记录表"),
                new Material(30, "补充合同"),
                new Material(16, "系统调试记录"),
                new Material(17, "试运行记录")

        ));

        // 项目验收（阶段4）
        STAGE_MATERIALS.put(4, Arrays.asList(
                new Material(4, "正式合同"),
                new Material(5, "正式清单"),
                new Material(6, "竣工报告(项目验收单)"),
                new Material(22, "竣工结算清单"),
                new Material(11, "施工安全协议书-昊诚"),
                new Material(13, "设备签收单"),
                new Material(14, "联系单"),
                new Material(15, "进度节点记录表"),
                new Material(30, "补充合同"),
                new Material(16, "系统调试记录"),
                new Material(17, "试运行记录"),
                new Material(18, "项目验收单"),
                new Material(19, "项目材料结算单"),
                new Material(20, "劳务费用结算单"),
                new Material(21, "其他资料")
        ));
    }

    /**
     * 根据阶段获取所有应该上传的材料（包含前置阶段）
     */
    public static List<Material> getAllowedMaterials(int stage) {
        Set<Material> result = new LinkedHashSet<>();

        if (stage == 2) {
            result.addAll(STAGE_MATERIALS.getOrDefault(2, Collections.emptyList()));
        } else if (stage == 3) {
            result.addAll(STAGE_MATERIALS.getOrDefault(2, Collections.emptyList()));
            result.addAll(STAGE_MATERIALS.getOrDefault(3, Collections.emptyList()));
        } else if (stage == 4) {
            result.addAll(STAGE_MATERIALS.getOrDefault(2, Collections.emptyList()));
            result.addAll(STAGE_MATERIALS.getOrDefault(3, Collections.emptyList()));
            result.addAll(STAGE_MATERIALS.getOrDefault(4, Collections.emptyList()));
        }

        return new ArrayList<>(result);
    }
}